﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using QLNhaSach;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using DataAccessLayer;

namespace BusinessLogicLayer
{
    public class TheLoaiBO
    {
        private TheLoaiDAL dal;
        public TheLoaiBO()
        {
            try
            {
                dal = new TheLoaiDAL();
            }
            catch (Exception e)
            {
                throw new BusinessLogicException();
            }
        }
        public TheLoai GetTheLoaiByID(int id)
        {
            TheLoai tg = null;
            try
            {
                tg = dal.GetTheLoaiByID(id);
            }
            catch (Exception)
            {
                throw;
            }
            return tg;
        }
        public TheLoai GetIDByName(string name)
        {
            TheLoai tg = null;
            try
            {
                tg = dal.GetIDByName(name);
            }
            catch (Exception)
            {
                throw;
            }
            return tg;
        }
        public DataTable GetDanhSachTheLoai()
        {
            DataTable tl = null;
            try
            {
                tl = dal.GetDanhSachTheLoai();
            }
            catch (Exception)
            {
                throw;
            }
            return tl;
        }
        public int InsertTheLoai(TheLoai tl)
        {
            int dt = 0;
            try
            {
                dt = dal.InsertTheLoai(tl);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int DeleteTheLoai(string tacGia)
        {
            int dt = 0;
            try
            {
                dt = dal.DeleteTheLoai(tacGia);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int UpdateTheLoai(TheLoai tl)
        {
            int dt = 0;
            try
            {
                dt = dal.UpdateTheLoai(tl);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
    }
}
